import { defineStore } from "pinia";
import { WorkFlowConfigStates } from './interface';

/**
 * 工作流配置
 */
export const useWorkFlowConfig = defineStore('workFlowConfig', {
    state: (): WorkFlowConfigStates => ({
        nodeMap: new Map(),
        selectedNode: {},
        selectFormItem: null,
        design: {
            formItems: [],
            formConfig: {},
            process: {},
            logo: {
                icon: 'ele-Eleme',
                background: '#1e90ff',
            },
            settings: {
                customPrint: null,
                printTemplate: null
            }
        },
        formItemMap: {}
    }),
    actions: {
        setSelectedNode(val: object) {
            this.selectedNode = val
        },
        loadForm(val: object) {
            this.design = val
        },
        setIsEdit(val: boolean) {
            this.isEdit = val
        },
        setSelectForm(val: any[]) {
            this.selectFormItem = val
        },
        setformItemMap(val: object) {
            this.formItemMap = val
        }
    }
})